﻿<html lang="ch"><head>
	<meta charset="utf8">
	<title>登录</title>
	<meta name="viewport" content="width=device-width initial-scale=1 user-scalable=no"/>
	<script src="https://res.wx.qq.com/open/js/cloudbase/1.1.0/cloud.js"></script>
	<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
	<link rel="stylesheet" href="../js/bootstrap/css/bootstrap.min.css">
	<script src="../js/bootstrap/js/bootstrap.min.js"></script>
	<script src="../js/a3.js"></script>
	<script src="../js/wxCloud.js?type=7"></script>
	<script type="text/javascript" src="../js/login.js"></script>
	<link rel="stylesheet" type="text/css" href="../css/public.css">
	<style type="text/css">
		body{

			background-image: url("../img/3c00755be0deee39d9858fbeeb3d4f0.jpg");
			background-repeat: no-repeat;
			background-size: 100%;
		}
		.user,.nextPassword,#register_sub,#gotoLogin,#wanjipassword_sub{
			display: none;
		}
	</style>
</head>
<body>
	
	<div class="modal-dialog" style="margin-top: 10%;">
        <div class="modal-content">
            <form class="bs-example bs-example-form" role="form" id="logform">
	            <div class="modal-header">
	                <h4 class="modal-title text-center" id="myModalLabel">登录</h4>
	            </div>
	            <div class="modal-body" id = "model-body">
	                
	                <div class="form-group email">
	                    <input type="email" name="email" class="form-control" placeholder="邮箱" autocomplete="off">
	                </div>
	                <div class="form-group user" >
	                    <input type="text" name="user" class="form-control"placeholder="用户名" autocomplete="off">
	                </div>
	                <div class="form-group password">
	                    <input type="password" name="password" class="form-control" placeholder="密码" autocomplete="off">
	                </div>
	                <div class="form-group nextPassword">
	                    <input type="password" name="nextPassword" class="form-control" placeholder="确认密码" autocomplete="off">
	                </div>

	            </div>
            </form>
	            <div class="modal-footer">
	            	<div class="form-group">
	                	<small style="color:red;" id="wanjipassword">忘记密码？</small>
	                </div>
	 
	                <div class="form-group">
	                    <button type="button" class="btn btn-primary form-control" id="login">登录</button>
	                </div>
	                <div class="form-group">
	                    <button type="button" class="btn btn-default form-control" id="register">注册</button>
	                </div>
	                <div class="form-group">
	                    <button type="button" class="btn btn-primary form-control" id="wanjipassword_sub">确认</button>
	                </div>
	                <div class="form-group">
	                    <button type="button" class="btn btn-primary form-control" id="register_sub">确认</button>
	                </div>
	                <div class="form-group">
	                    <button type="button" class="btn btn-default form-control" id="gotoLogin">返回</button>
	                </div>
         
	            </div> 
        </div>
    </div>


    


	
</body>
</html>
<script type="text/javascript">
$(function(){




	//注册时的界面
	$("#register").click(function(e){

		$(".user").show()
		$(".nextPassword").show()
		$("#register_sub").show()
		$("#gotoLogin").show()
		$("#myModalLabel").text('注册')

		$(this).hide()
		$("#login").hide()

	})
	//返回登录时的逻辑
	$("#gotoLogin").click(function(e){

		$(".user").hide()
		$(".nextPassword").hide()
		$("#register_sub").hide()
		$("#gotoLogin").hide()
		$("#wanjipassword_sub").hide()
		$("#myModalLabel").text('登录')

		$(".password").show()
		$("#register").show()
		$("#login").show()

	})


	$("#register_sub").click(function(){ //注册逻辑
		login.zhuce()
	})

	$("#login").click(function(){ //登陆逻辑

		// document.cookie="sgbId=John Doe; expires=Thu, 18 Dec 2021 12:00:00 GMT; path=/";
		login.loginYanZheng()



	})

	$("#wanjipassword").click(function(){

		$(".user").hide()
		$(".password").hide()
		$(".nextPassword").hide()
		$("#register_sub").hide()
		$("#gotoLogin").hide()
		$("#myModalLabel").text('忘记密码')
		$("#register").hide()
		$("#login").hide()

		$("#wanjipassword_sub").show()
		$("#gotoLogin").show()


	})


	function getformdata(){


		var formeles = $("#logform")[0].elements

		var res = {}

		for(var i = 0 ; i < formeles.length ; i++){

			res[formeles[i].name]=formeles[i].value
			
		}

		return res



	}


	function wxUsernameAndEmailyanzheng(name,whereObj,fun){

		wxCloud.cloud().callFunction({
			name:name,
			data:whereObj,
			success:function(res){
				console.log(name+"=>",res)
				if(res.result == null){
					fun(0)
				}else{

					var len =  res.result.data.length

					fun(len)
				}
				
			},
			fail:function(error){
				console.log(error)
			}
		})
	}



})
</script>
<script type="text/x-dot-template" id="">

</script>